--5I6of5zJg18YgZEa
Content-Type: multipart/mixed; boundary="DocE+STaALJfprDB"
Content-Disposition: inline
--DocE+STaALJfprDB
Content-Type: text/plain; charset=iso-8859-2
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
Hello,
The attached patch allows specifying a directory as lwp-download's
second argument. Also makes "0" valid destination file name.
PS Please Cc me with eventual replies, I don't subscribe this list.
--
Rados=B3aw Zieli=F1ski <radek [at] karnet.pl>
[ GPG key: http://radek.karnet.pl/ ]
--DocE+STaALJfprDB
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="perl-libwww-lwp_download_dest_dir_support.patch"
Content-Transfer-Encoding: quoted-printable
--- bin/lwp-download 2004-11-14 07:36:25.000000000 +0100
+++ bin/lwp-download 2004-12-10 21:12:41.136510344 +0100
[at] [at] -91,7 +91,13 [at] [at]
sub {
unless($file) {
my $res =3D $_[1];
- unless ($argfile) {
+
+ my $directory;
+ if (defined $argfile && -d $argfile) {
+ ($directory, $argfile) =3D ($argfile, undef);
+ }
+
+ unless (defined $argfile && length $argfile) {
# must find a suitable name to use. First thing
# to do is to look for the "Content-Disposition"
# header defined by RFC1806. This is also supported
[at] [at] -130,6 +136,11 [at] [at]
}
}
+ if (defined $directory) {
+ require File::Spec;
+ $file =3D File::Spec->catfile($directory, $file);
+ }
+
# Check if the file is already present
if (-f $file && -t) {
$shown =3D 1;
[at] [at] -292,3 +303,5 [at] [at]
{
die "Usage: $progname [-a] <url> [<lpath>]\n";
}
+
+# vi: ts=3D8 sw=3D4
--DocE+STaALJfprDB--
--5I6of5zJg18YgZEa
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
iD8DBQFBugg4vesRuUOywuARAlA1AKDBF+JiUoFENhJ/938AsMm1Fi2L+wCd FiJz
Z1D+siTdOewjT+zQg1JtNgw=
=oV2E
-----END PGP SIGNATURE-----
--5I6of5zJg18YgZEa--
